﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--<%@ page import="com.iWen.survey.dao.DAOFactory"%>
<%@ page import="com.iWen.survey.dto.Link" %>
<%@ page import="com.iWen.survey.dao.LinkDAO" %>--%>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<%--<%
	LinkDAO dao=DAOFactory.getLinkDAO();
	List<Link> lList=dao.listAllLink();
%> --%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <title>My JSP 'SurveyAudi.jsp' starting page</title>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">

    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/Css/Admin.css">
    <link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/Css/bootstrap.min.css">
    <script language="JavaScript" src="${pageContext.request.contextPath}/Js/Func.js"></script>
    <script language="JavaScript" src="${pageContext.request.contextPath}/Js/jquery-1.7.2.js"></script>
    <script language="javascript">window.onload = tableFix;</script>
    <script type="text/javascript">
        function DelLink(lid) {
            if (confirm("确定要删除这个链接吗？") == true){
                $.post(
                    "/link/delLink?lid=" + lid,
                     function (data) {
                         if(data.code==200){
                             alert("删除成功");
                             window.location.href="/link/manage";
                         }
                         else{
                             alert("删除失败");
                         }
                     },"json"
                )
            }
        }
    </script>
</head>
<body>
<div class=nav><a href=admin_main.jsp>桌面</a>»友情链接列表
</div>
<table class=table cellspacing="0" cellpadding="0" align="center">
    <tbody>
    <tr>
        <th width=7%>编号</th>
        <th width=20%>网址</th>
        <th>名称</th>
        <th width=25%>描述</th>
        <th>操作 <br></th>
    </tr>
    <c:forEach items="${pageBean.list}" var="link">
        <tr>
            <td>${link.id}</td>

            <td>${link.url}</td>

            <td>${link.name}</td>

            <td>${link.info}</td>

            <td><a href=${pageContext.request.contextPath}/link/getLink?lid=${link.id}>编辑</a>|<a
                    href='javascript:DelLink(${link.id})'>删除</a></td>
        </tr>
    </c:forEach>
    </tbody>

    <%
        /*for (Link link : lList)*/
        {
    %>
    <%--<tr>
        <td><%=link.getLId() %>
        </td>
        <td><a href=<%=link.getLUrl() %>><%=link.getLUrl() %>
        </a></td>
        <td><%=link.getLName() %>
        </td>
        <td><%=link.getLInfo() %>
        </td>
        <td><a href=LinkModifg.jsp?lid=<%=link.getLId() %>>编辑</a>|<a
                href='javascript:DelLink(<%=link.getLId() %>)'>删除</a></td>
    </tr>--%>
    <%} %>

</table>
<!--分页-->
<div class="pull-right">
    <script type="text/javascript">
        function page(pageCode) {
            window.location.href = "${pageContext.request.contextPath}/link/manage/" + pageCode;
        }
    </script>
    <jsp:include page="../page.jsp"></jsp:include>
</div>
<%--
提示：由于版面有限，前台页面上仅显示前7个友情链接，请酌情调整。
--%>
</body>
</html>
